const Koa = require('koa');
const cors = require('@koa/cors');
const app = new Koa();
// // log request URL:
// app.use(async(ctx, next) => {
//     ctx.response.set('Access-Control-Allow-Origin', '*')
//         // console.log(`Process ${ctx.request.method} ${ctx.request.url}...`);
//     await next();
// });
// 引入路由分发
app.use(cors());

const router = require('./routes')
app.use(router.routes())

app.listen(3000, () => {
    console.log(`Server Start at: http://localhost:3000`);
})